<?php

/*
	ONLINE COLLEGE SUPPORT CONTACT FORM
	Form last updated 12/16/2009 by J. Mueller (updated semester codes - added in php to not display one Problem type)
	Modified for live website 01/16/07 by J. Hock
	>> Changes made: extraneous HTML tags (head, body, etc.) stripped from page.
	>> See inline comments for instructions on changing database calls.
	Modified for support.sbcc.edu website 4/6/07 by J. Hock
	>> Changes made: form reformatted for standalone page. Form values are now passed back to the form if an error occurs.
    >> Removed SSN and course fields.
	>> Added to new website redesign 17-Aug-09 J. Hock
*/

//include_once "admin/db.php";  // Commented out Jenn Mueller's database call.
require_once('/web/wwwroot/dbConn.php');
mysql_select_db("onlinesupport"); // Select support database - not required to log in as online support user.
$browsers = mysql_query("select * from browser_type");
$computer = mysql_query("select * from computer_type");
$problem = mysql_query("select * from problem_type");
$os = mysql_query("select * from operating_system");
//$courses = mysql_query("SELECT * FROM current_courses ORDER BY course_number,section");

 if($_GET[MyName] == "error") {
   print "* ";

   
  }?>


<FORM action="http://support.sbcc.edu/online-contact-action.php" METHOD="POST">
	<?
if ($_GET[error]=='true') {
 echo '<p class="error">Please complete the following required fields:</p><ul>';
  if($_GET[userid] == "error") {
   print "<li class='error'>Enter your <b>UserID</b>.</li>";
   $_GET[userid] = '';
  } 
 if($_GET[f_name] == "error") {
   print "<li class='error'>Enter your <b>First Name</b>.</li>";
   $_GET[f_name] = '';
  }
  if($_GET[l_name] == "error") {
   print "<li class='error'>Enter your <b>Last Name</b>.</li>";
   $_GET[l_name] = '';
  } 
  if($_GET[birthdate] == "error") {
   print "<li class='error'>Enter your <b>Birthdate</b>.</li>";
   $_GET[birthdate] = '';
  }
    if($_GET[email] == "error") {
   print "<li class='error'>Enter your <b>Email Address</b>.</li>";
   $_GET[email] = '';
  }
   if($_GET[dayphone] == "error") {
   print "<li class='error'>Enter your <b>Daytime Phone Number</b>.</li>";
   $_GET[dayphone] = '';
  }
      if($_GET[call] == "error") {
   print "<li class='error'>Please indicate whether or not you have previously left a phone message for the help desk.</li>";
   $_GET[call] = '';
  }
    if($_GET[Platform] == "error") {
   print "<li class='error'>Select your <b>Computer Type</b>. If you don't know, select Unknown.</li>";
   $_GET[Platform] = '';
  }
    if($_GET[browser] == "error") {
   print "<li class='error'>Enter your <b>Browser Type</b>.  If you don't know, select Unknown.</li>";
   $_GET[browser] = '';
  }
  if($_GET[operating_system] == "error") {
   print "<li class='error'>Enter your <b>Operating System</b>. If you don't know, select Unknown.</li>";
   $_GET[operating_system] = '';
  } 
  if($_GET[course] == "error") {
   print "<li class='error'>Enter your <b>Course/CRN</b>. If the problem is not about a class, enter 'n/a'.</li>";
   $_GET[course] = '';
  }
   if($_GET[problem_type] == "error") {
   print "<li class='error'>Select your <b>Problem Type</b>. If you don't know, select Other.</li>";
   $_GET[problem_type] = '';
 }
 echo '</ul>';
}
?>
   <table BORDER=0 cellpadding=5 cellspacing=0 bordercolor="#006699" bgcolor="#FFFFFF" >
<!--    <tr align="left" valign="top">
      <td colspan="2" bordercolor="#006699" bgcolor="#006699"><font color="white"><strong>Pipeline and WebCT Vista Student Support Form</strong></td>
    </tr>-->
	<tr>
	  <td height="29" colspan="2">&nbsp;</td>
     </tr>
	<tr>
	<td height="29" colspan="2" align=center><font color="red"><strong>* = Required Fields</strong></font></td>
	</tr>
    <tr valign="top">
      <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>First Name</b></td>
      <td align="left"><input name="f_name" type="TEXT" id="f_name" value="<? echo $_GET[f_name]; ?>" size="35" maxlength="50"></td>
     </tr>
    <tr valign="top">
      <td width="250" align="right" class="normalblue"><b><font color="#FF0000"></font>Middle Initial</b></td>
      <td align="left"><input name="m_initial" type="TEXT" id="m_initial" value="<? echo $_GET[m_initial]; ?>" size="2" maxlength="1"></td>
     </tr>
     <tr valign="top">
       <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Last Name</b></td>
       <td align="left"><input name="l_name" type="TEXT" id="l_name" value="<? echo $_GET[l_name]; ?>" size="35" maxlength="50"></td>
     </tr>
     <tr valign="top">
       <td width="250" align="right" class="normalblue"><b>Other Names used (old last name)</b></td>
       <td align="left"><input name="o_name" type="TEXT" id="o_name" value="<? echo $_GET[o_name]; ?>" size="35" maxlength="50"></td>
     </tr>
     <tr valign="top">
       <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Birthdate</b></td>
       <td align="left"><input name="birthdate" type="TEXT" id="" value="<? echo $_GET[birthdate]; ?>" size="35" maxlength="30"></td>
     </tr>
     <tr valign="top">
       <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Pipeline Username</b></td>
       <td align="left"><input name="userid" type="TEXT" id="userid" value="<? echo $_GET[userid]; ?>" size="35" maxlength="15"></td>
     </tr>
     <tr valign="top">
       <td width="250" align="right" class="normalblue"><b>SBCC Student ID Number </b></td>
       <td align="left"><input name="KNum" type="TEXT" id="KNum" value="<? echo $_GET[KNum]; ?>" size="35" maxlength="9"> (example: K00xxxxxx)</td>
     </tr>
	 <tr valign="top">
       <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Daytime Phone</b></td>
       <td align="left"><input name="dayphone" type="TEXT" id="dayphone" value="<? echo $_GET[dayphone]; ?>" size=35 maxlength="20"></td>
     </tr>
    <tr valign="top">
      <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Email Address</b></td>
      <td align="left"><input name="email" type="TEXT" id="email" value="<? echo $_GET[email]; ?>" size="35" maxlength="50"></td>
     </tr>
    <tr valign="top">
      <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Did you also call the help desk and leave a message about this problem?</b></td>
      <td align="left"><span class="normalblue">
        <input name="call" type="radio" value="1" <? if ($_GET[call]=='1') echo ' checked'; ?>>
Yes
<input name="call" type="radio" value="2" <? if ($_GET[call]=='2') echo ' checked'; ?>>
No &nbsp;</span></td>
     </tr>
    <tr valign="top">
      <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Computer Type</b></td>
      <td align="left" class="normalblue"><select name="Platform" size=1>
        <option value="">Select your computer...</option>
        <?php
		 while($computerresults = mysql_fetch_array($computer)) {
		 echo "<option value=\"".$computerresults[CT_ID]."\"";
		 if ($computerresults[CT_ID]==$_GET[Platform]) echo ' selected';
		 echo ">".$computerresults[CT_desc]. "</option>\n";
	      }
	     ?>
      </select></td>
     </tr>
    <tr valign="top">
      <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Browser Type</b></td>
      <td align="left" class="normalblue"><select  name="browser" size=1 id="browser">
        <option  value="">Select a Browser...</option>
        <?php
		 while($browsersresults = mysql_fetch_array($browsers)) {
		 echo "<option value=\"".$browsersresults[BT_ID]."\"";
		 if ($browsersresults[BT_ID]==$_GET[browser]) echo ' selected';
		 echo ">".$browsersresults[BT_desc]. "</option>\n";
	      }
	     ?>
      </select></td>
     </tr>
    <tr valign="top">
      <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Operating System</b></td>
      <td align="left" class="normalblue"><select  name="operating_system" size=1 id="operating_system">
        <option value="">Select your Operating System</option>
        <?php
		 while($osresults = mysql_fetch_array($os)) {
		 echo "<option value=\"".$osresults[os_id]."\"";
		 if ($osresults[os_id]==$_GET[operating_system]) echo ' selected';
		 echo ">".$osresults[os_desc]. "</option>\n";
	      }
	     ?>
      </select></td>
     </tr>   
    <tr valign="top">
      <td align="right" class="normalblue"><b>Semester</b></td>
      <td align="left" class="normalblue">
      <input name="semester" type="radio" value="Spring10" <? if ($_GET[semester]=='Spring10') echo ' checked'; ?>>
     Spring 2010<br/>
<input name="semester" type="radio" value="Fall2009" <? if ($_GET[semester]=='Fall2009') echo ' checked'; ?>>
     Fall 2009     </td>
    </tr>
        <tr valign="top">
      <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Course/<acronym title="Course Resource Number">CRN</acronym></b><br />(type N/A if problem not about a class)</td>
      <td align="left"><input name="course" type="TEXT" id="course" value="<? echo $_GET[course]; ?>" size="35" maxlength="30"></td>
     </tr>
     <tr valign="top">
      <td width="250" align="right" class="normalblue"><b><font color="#FF0000">*</font>Problem or Question Category</b></td>
      <td align="left" class="normalblue"><select  name="problem_type" size=1 id="problem_type" value="">
        <option value="">Select your problem type...</option>
        <?php
		function checkPT_ID($pt) {
			// You can enter in more values here if you like to block them out on support page.
			if ($pt == '28') { return FALSE; }
			else { return TRUE; }
		}
 
		 while($problemresults = mysql_fetch_array($problem)) {
		  	if (checkPT_ID($problemresults[PT_ID])) {
			echo "<option value=\"".$problemresults[PT_ID]."\"";
			if ($problemresults[PT_ID]==$_GET[problem_type]) { echo ' selected'; }
			echo ">".$problemresults[PT_desc]. "</option>\n";
			}
	      }
	     ?>
      </select></td>
     </tr>
     <tr valign="top">
       <td width="250" align="right" class="normalblue"><b>Please describe your problem here:</b></td>
       <td align="left" class="normalblue"><textarea name="Problem" rows=5 cols=40 wrap="soft"><? echo $_GET[Problem] ?></textarea></td>
     </tr>
     <tr valign="top">
       <td width="250" align="right" class="normalblue">&nbsp;</td>
	  <td align="left" class="normalblue"><input type=SUBMIT value="Submit!" name="SUBMIT"></td>
     </tr>
  </table>
</FORM>
